﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Media.Imaging;

namespace pGrid
{
	[Serializable]
	public partial class PowerStation
	{
		// картинка станции
		private BitmapImage m_pic;
		
		// номер станции
		private int m_number;
		
		// стоимость станции
		private int m_cost;

		// количество ресурсов, необходимое станции на один ход
		private int m_needed_res_num;

		// реальное кол-во ресурсов, которые лежат на складах станции
		private int m_real_res_num;

		// количество городов,которые может обеспечить станция
		private int m_cities_num;

		// тип электростанции
		private ResourseType m_type;

		public PowerStation()
		{
		}

		public PowerStation(int number, int cost, int resourses_num, int cities_num, ResourseType type)
		{
			this.m_number = number;
			this.m_cost = cost;
			this.m_needed_res_num = resourses_num;
			this.m_real_res_num = 0;
			this.m_cities_num = cities_num;
			this.m_type = type;

			string path = number.ToString() + ".jpg";
			Stream stream = File.Open(path, FileMode.Open);
			this.m_pic = new BitmapImage();
			this.m_pic.BeginInit();
			this.m_pic.StreamSource = stream;
			this.m_pic.EndInit();
			
			// number.ToString() + ".jpg";
		}
		/*
		public PowerStation operator = (PowerStation item)
		{
			this.m_number = item.Number;
			this.m_cost = item.Cost;
			this.m_needed_res_num = item.NeededResNum;
			this.m_real_res_num = item.RealResNum;
			this.m_cities_num =item.CitiesNum;
			this.m_type =item.Type;
			this.m_pic = item.Pic;
		}*/
		public int CitiesNum
		{
			get
			{
				return this.m_cities_num;
			}
			set
			{
				this.m_cities_num = value;
			}
		}

		public int Cost
		{
			get
			{
				return this.m_cost;
			}
			set
			{
				this.m_cost = value;
			}
		}

		public int NeededResNum
		{
			get
			{
				return this.m_needed_res_num;
			}
			set
			{
				this.m_needed_res_num = value;
			}
		}

		public int RealResNum
		{
			get
			{
				return this.m_real_res_num;
			}
			set
			{
				this.m_real_res_num = value;
			}
		}

		public BitmapImage Pic
		{
			get
			{
				return (BitmapImage)this.m_pic;
			}
			set
			{
				this.m_pic = (BitmapImage)value;
			}
		}

		public ResourseType Type
		{
			get
			{
				return this.m_type;
			}
			set
			{
				this.m_type = value;
			}
		}

		public int Number
		{
			get
			{
				return this.m_number;
			}
			set
			{
				this.m_number = value;
			}
		}
	}
}
